package cn.itcast.order;

import cn.itcast.feign.config.FeignConnfig;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
// 开启远程调用userserver   全局生效
@EnableFeignClients(basePackages = "cn.itcast.feign",defaultConfiguration = FeignConnfig.class)
@MapperScan("cn.itcast.order.mapper")
@SpringBootApplication
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }
    @Bean
    @LoadBalanced // 开启负载均衡功能
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
   /* @Bean
    public IRule randomRule(){
        // 配置负载均衡规则,随机规则
        return new RandomRule();
    }*/
}